package com.baizhi.hospital.service.impl;

import com.baizhi.hospital.annotation.LogAnnotation;
import com.baizhi.hospital.dao.FilesDao;
import com.baizhi.hospital.entity.Files;
import com.baizhi.hospital.service.FilesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class FilesServiceImpl implements FilesService {
    @Autowired(required = false)
    private FilesDao filesDao;
    @Override
    //@LogAnnotation(value = "查询文件信息",type = "selectFilesByPage")
    public Map selectFilesByPage(int page, int limit, String fileName) {
        if(fileName==null||fileName==""){
            fileName=null;
        }else{
            fileName="%"+fileName+"%";
        }
        Map map=new HashMap();
        int offset=(page-1)*limit;
        List<Files> files = filesDao.selectFilesByPage(offset, limit, fileName);
        int count = filesDao.selectCount(fileName);
        map.put("code",0);
        map.put("msg","");
        map.put("count",count);
        map.put("data",files);
        return map;
    }
}
